﻿using System;
using System.Configuration;
using System.Reflection;

namespace BGShell.Configuration
{
    public sealed class BGShellAddInElement : ConfigurationElement
    {
        [ConfigurationProperty("key", IsKey = true, IsRequired = true)]
        public string Key
        {
            get { return (string)this["key"]; }
            set { this["key"] = value; }
        }

        [ConfigurationProperty("assemblyName", IsRequired = true)]
        public string AssemblyName
        {
            get { return (string)this["assemblyName"]; }
            set { this["assemblyName"] = value; }
        }

        internal Assembly LoadAssembly()
        {
            if (!string.IsNullOrEmpty(AssemblyName))
            {
                return Assembly.Load(AssemblyName);
            }

            return null;
        }

    }
}
